package com.example.lss.news.utils.db;

import android.app.Application;

import com.example.lss.news.bean.User;

import io.realm.Realm;
import io.realm.RealmConfiguration;

public class DBHelper {
    public static void init(Application application) {
        Realm.init(application);
        RealmConfiguration config = new RealmConfiguration.Builder()
                .schemaVersion(1)
                .name("NEWS")

                .deleteRealmIfMigrationNeeded()
                .initialData(new Realm.Transaction() {
                    @Override
                    public void execute(Realm realm) {
                        realm.insert(new User(null,"123321", "123",null,"storage/emulated/0/launcher/ad/00733dea98cd0b3b5375110f9cd34f27.png",null,null,null,null));
                    }
                })
                .build();
        Realm.setDefaultConfiguration(config);
    }
}
